<template>
	<view class="message-set">
		<div :style="{
	  	height:`${statusBarHeight}px`,
	  	background:'#2f9aff'
	  }"></div>
		<view :style="{height: `${topHeight}px`,paddingLeft:`${pagePadding}px`,paddingRight:`${pagePadding}px`}">
			<view class="personal-title">
				<i class="clearIcon" @click="goBack"></i>
				<text>意见反馈</text>
			</view>
		</view>
		<view class="message-set-item">
			<text>接收通知</text>
			<switch :checked="notificationEnabled" @change="toggleNotification" color="#00C853" />
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'

	const notificationEnabled = ref(true)

	const toggleNotification = (e) => {
		notificationEnabled.value = e.detail.value
	}
	
	const statusBarHeight = ref(0); // 状态栏高度
	const topHeight = ref(0); // 胶囊高度
	const pagePadding = ref(0);
	
	
	onMounted(() => {
		const systemInfo = uni.getSystemInfoSync();
		statusBarHeight.value = systemInfo.statusBarHeight; // 获取状态栏高度
	
		const res = uni.getMenuButtonBoundingClientRect();
		pagePadding.value = systemInfo.screenWidth - res.right
		topHeight.value = res.height + (res.top - statusBarHeight.value) * 2
	});
	// 处理页面跳转
	const goBack = () => {
		uni.navigateBack()
	}
</script>

<style lang="scss">
	.personal-title {
		height: 100%;
		font-size: 38rpx;
		font-weight: 700;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
	
		.clearIcon {
			position: absolute;
			height: 100%;
			width: 60rpx;
			background: url(/static/images/my/ic_fanhui@2x.png)no-repeat center;
			background-size: 35%;
			left: 0;
			top: 0;
		}
	}
	.message-set {
		min-height: 100vh;
		background-color: #F5F5F5;

		&-header {
			padding: 32rpx;
			font-size: 32rpx;
			font-weight: bold;
			background-color: #FFFFFF;
		}

		&-content {
			margin-top: 20rpx;
			background-color: #FFFFFF;
		}

		&-item {
			position: relative;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 32rpx;
			font-size: 28rpx;
			border-bottom: 2rpx solid #F5F5F5;

			&-right {
				margin-right: 40rpx;
				color: #999999;
			}
		}

		&-desc {
			padding: 20rpx 32rpx;
			font-size: 24rpx;
			color: #999999;
		}

		.arrow-right {
			position: absolute;
			right: 32rpx;
			width: 32rpx;
			height: 32rpx;
		}
		.message-set-item{
			background-color: white;
		}
	}
</style>